<?php /* Smarty version 2.6.20, created on 2016-07-19 18:10:09
         compiled from special.htm */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('modifier', 'date_format', 'special.htm', 115, false),array('function', 'html_select_time', 'special.htm', 116, false),)), $this); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>专题活动</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="admin.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="../module/inventory/css/admin/index.css" />
<script type="text/javascript" src="../script/jquery-1.4.4.min.js"></script>
<script language="javascript" src="../script/Calendar.js"></script>
<script type="text/javascript" src="../module/inventory/scripts/yui/yahoo-dom-event/yahoo-dom-event.js" ></script>
<script type="text/javascript" src="../module/inventory/scripts/yui/dragdrop/dragdrop-min.js" ></script>
<script type="text/javascript" src="../module/inventory/scripts/yui/calendar/calendar-min.js"></script>
<script type="text/javascript" src="../module/inventory/scripts/index.js"></script>
<script type="text/javascript" src="../script/jquery.validation.min.js"></script>
<script src="../script/my_lightbox.js" language="javascript"></script>

<script>
$(function(){
	$('#form').validate({
		errorPlacement: function(error, element){
			element.next('.form-error').append(error);
		},      
		rules : {
			title:{
				required:true
			},
			stime:{
				required:true
			},
			etime:{
				required:true
			},
		},
		messages : {
			title:{
				required:'请填写标题',
			},
			etime:{
				required:'请填写开始时间',
			},
			stime:{
				required:'请填写结束时间',
			}
		}
	});
	$('#type').change(function(){
		var s=$(this).val();
		$('span[id^=type_]').hide()
		if(s!=0){
			$('#type_'+s).show();
		}
		
		
	});
	
	//删除新增的楼层节点
    $('.delfloor').live("click",function(){
        $(this).parent().parent().remove();
     });
	
});

//添加楼层
function _addfloor(){
    $('.floor_box').append('<tr><td><input type="text" name="new_floor[]" class="text"  value="" /></td><td><input type="text" name="new_fbgcolor[]" class="text" value="" /> </td><td><input type="text" name="new_fdisplayorder[]" class="text" value="" /> </td><td><img class="delfloor" src="../image/admin/delete.png"></td></tr>');
}

</script>
<style>
.delfloor{
	cursor:pointer;
}
</style>
</head>
<body>
	<div class="container">
        <div class="flow">
            <div class="itemtitle">
                <h3>专题活动</h3>
                <ul>
                    <li <?php if ($_GET['operation'] == ''): ?>class="current"<?php endif; ?>><a href="?m=activity&s=special.php"><span>管理</span></a></li>
                    <li <?php if ($_GET['operation'] == 'add'): ?>class="current"<?php endif; ?>><a href="?m=activity&s=special.php&operation=add"><span>添加</span></a></li>
                    <?php if ($_GET['operation'] == 'edit'): ?>
                    <li class="current"><a href="#"><span>修改</span></a></li>
                    <?php endif; ?>
                </ul>
            </div>
        </div>
        <div class="h35"></div>  
        <?php if ($_GET['operation'] == 'add' || $_GET['operation'] == 'edit'): ?>
            <form name="form" id="form" method="post">
            <input name="id" type="hidden" id="id" value="<?php echo $this->_tpl_vars['de']['id']; ?>
">
            <table class="table">
                <thead>
                    <tr>
                        <th class="partition" colspan="99">专题活动</th>
                    </tr>
                </thead>
                <tbody>
                <tr>
                    <td width="100">标题</td>
                    <td>
                    <input name="title" id="title" type="text" class="w350" value="<?php echo $this->_tpl_vars['de']['title']; ?>
"><div id="form-error" class="form-error"></div>
                    </td>
                </tr>
                
                <tr>
                    <td>起止时间</td>
                    <td>
                    <script language="javascript">
                    var cdr = new Calendar("cdr");
                    document.write(cdr);
                    cdr.showMoreDay = true;
                    </script>
                    <input onFocus="cdr.show(this);" class="ltext" type="text" name="stime" id="stime" value="<?php echo ((is_array($_tmp=$this->_tpl_vars['de']['start_time'])) ? $this->_run_mod_handler('date_format', true, $_tmp) : smarty_modifier_date_format($_tmp)); ?>
"> 
                    <?php echo smarty_function_html_select_time(array('use_24_hours' => true,'display_seconds' => false,'prefix' => 'start','time' => $this->_tpl_vars['de']['start_time']), $this);?>

                    - 
                    <input onFocus="cdr.show(this);" class="rtext" type="text" name="etime" id="etime" value="<?php echo ((is_array($_tmp=$this->_tpl_vars['de']['end_time'])) ? $this->_run_mod_handler('date_format', true, $_tmp) : smarty_modifier_date_format($_tmp)); ?>
">
                    <?php echo smarty_function_html_select_time(array('use_24_hours' => true,'display_seconds' => false,'prefix' => 'end','time' => $this->_tpl_vars['de']['end_time']), $this);?>

                    <div id="form-error" class="form-error"></div>
                    </td>
                </tr>
                
                
                
               <tr>
                    <td>促销类型</td>
                    <td>
                        <select class="select"  name="type" id="type">
                        <option  <?php if ($this->_tpl_vars['de']['type'] == 0): ?>selected="selected"<?php endif; ?>  value="0">无促销</option>
                        <option  <?php if ($this->_tpl_vars['de']['type'] == 1): ?>selected="selected"<?php endif; ?>  value="1">直降</option>
                        <option  <?php if ($this->_tpl_vars['de']['type'] == 2): ?>selected="selected"<?php endif; ?>  value="2">满减</option>
                        </select>
                        <span id="type_1" <?php if ($this->_tpl_vars['de']['type'] != 1): ?>style="display:none;"<?php endif; ?>>
                       		直降：  <input type="text" class="w60" name="type_config_1" value="<?php echo $this->_tpl_vars['de']['type_config_1']['0']['0']; ?>
"/>
                        
                        </span>
                        <span id="type_2" <?php if ($this->_tpl_vars['de']['type'] != 2): ?>style="display:none;"<?php endif; ?>>
                        	<br/>
                       		<br/>满：  <input type="text" class="w60" name="type_config_2[0][0]" value="<?php echo $this->_tpl_vars['de']['type_config_2']['0']['0']; ?>
"/> 减： <input type="text" class="w60" name="type_config_2[0][1]" value="<?php echo $this->_tpl_vars['de']['type_config_2']['0']['1']; ?>
"/>
                        	<br/>满：  <input type="text" class="w60" name="type_config_2[1][0]" value="<?php echo $this->_tpl_vars['de']['type_config_2']['1']['0']; ?>
"/> 减： <input type="text" class="w60" name="type_config_2[1][1]" value="<?php echo $this->_tpl_vars['de']['type_config_2']['1']['1']; ?>
"/>
                        	<br/>满：  <input type="text" class="w60" name="type_config_2[2][0]" value="<?php echo $this->_tpl_vars['de']['type_config_2']['2']['0']; ?>
"/> 减： <input type="text" class="w60" name="type_config_2[2][1]" value="<?php echo $this->_tpl_vars['de']['type_config_2']['2']['1']; ?>
"/>
                        
                        </span>
                    </td>
                </tr>
                <tr>
                    <td>优惠券场景名称</td>
                    <td><input name="cpns_event_key" id="cpns_event_key" type="text" class="w350" value="<?php echo $this->_tpl_vars['de']['cpns_event_key']; ?>
"></td>
                </tr>
                <tr>
                    <td>背景色值</td>
                    <td><input name="bgcolor" id="bgcolor" type="text" class="w350" value="<?php echo $this->_tpl_vars['de']['bgcolor']; ?>
"></td>
                </tr>
                <tr>
                    <td>商品楼层</td>
                    <td width="300" height="300">
                                    <div>
            <table>
                <thead>
                <tr>
                    <td>楼层名称</td>
                    <td>背景色值</td>
                    <td>楼层顺序</td>
                    <td><a href="javascript:void(0);" onclick="_addfloor();" ><img src="../image/admin/addchildboard.png"></a></td>
                </tr> 
                </thead>
                <tbody class="floor_box">
                <?php $_from = $this->_tpl_vars['de']['floors']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['floor']):
?>
                <tr>
                    <td><input type="text" name="floor[<?php echo $this->_tpl_vars['floor']['id']; ?>
]" class="text"  value="<?php echo $this->_tpl_vars['floor']['title']; ?>
" /></td>
                    <td><input type="text" name="fbgcolor[<?php echo $this->_tpl_vars['floor']['id']; ?>
]" class="text" value="<?php echo $this->_tpl_vars['floor']['bgcolor']; ?>
" /> </td>
                    <td><input type="text" name="fdisplayorder[<?php echo $this->_tpl_vars['floor']['id']; ?>
]" class="text" value="<?php echo $this->_tpl_vars['floor']['displayorder']; ?>
" /> </td>
                    <td><a onclick="return confirm('确定删除吗');" href="?m=activity&s=special.php&operation=edit&editid=<?php echo $this->_tpl_vars['de']['id']; ?>
&act=delfloor&id=<?php echo $this->_tpl_vars['floor']['id']; ?>
"><img src="../image/admin/delete.png"></a></td>
                </tr>
                <?php endforeach; else: ?>
                <tr>
                    <td><input type="text" name="new_floor[]" class="text"  value="" /></td>
                    <td><input type="text" name="new_fbgcolor[]" class="text" value="" /> </td>
                    <td><input type="text" name="new_fdisplayorder[]" class="text" value="" /> </td>
                    <td><img class="delfloor" src="../image/admin/delete.png"></td>
                </tr>
                <?php endif; unset($_from); ?>
                </tbody>
            </table>
            </div>
                    </td>
                </tr>
                 <tr>
                    <td>展示模版</td>
                    <td>
                        <select class="select"  name="templates">
                        	<?php $_from = $this->_tpl_vars['de']['temp']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['list']):
?>
                        	<option value="<?php echo $this->_tpl_vars['list']['id']; ?>
" <?php if ($this->_tpl_vars['list']['id'] == $this->_tpl_vars['de']['templates']): ?>selected<?php endif; ?>>
                        	<?php echo $this->_tpl_vars['list']['title']; ?>

                        	
                        	</option>
                        	<?php endforeach; endif; unset($_from); ?>
                        </select>
                        </td>
                        </tr>
                <tr>
                    <td>关联分类</td>
                    <td>
                <select class="ws350" name='catid' >
                <option value='-1'>手选单品</option>
                    	<option value='0' <?php if ($this->_tpl_vars['de']['catid'] == 0): ?>selected="selected" <?php endif; ?>>全部分类</option>
                        <?php $_from = $this->_tpl_vars['de']['cat']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['list']):
?>
             			<option <?php if ($this->_tpl_vars['de']['catid'] == $this->_tpl_vars['list']['catid']): ?> selected="selected" <?php endif; ?> value="<?php echo $this->_tpl_vars['list']['catid']; ?>
"><?php echo $this->_tpl_vars['list']['cat']; ?>
</option>
             			<?php $_from = $this->_tpl_vars['list']['scat']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['slist']):
?>
                            <option <?php if ($this->_tpl_vars['de']['catid'] == $this->_tpl_vars['slist']['catid']): ?> selected="selected" <?php endif; ?> value="<?php echo $this->_tpl_vars['slist']['catid']; ?>
">|__<?php echo $this->_tpl_vars['slist']['cat']; ?>
</option>
                            	    
                                    <?php $_from = $this->_tpl_vars['slist']['scat']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['lists']):
?>
                                    <option <?php if ($this->_tpl_vars['de']['catid'] == $this->_tpl_vars['lists']['catid']): ?> selected="selected" <?php endif; ?> value="<?php echo $this->_tpl_vars['lists']['catid']; ?>
">|____<?php echo $this->_tpl_vars['lists']['cat']; ?>
</option>
                            		<?php endforeach; endif; unset($_from); ?> 
                                    
                            <?php endforeach; endif; unset($_from); ?> 
             			<?php endforeach; endif; unset($_from); ?>
            		</select> 
            		<a href="#" title="关联分类后整个分类的商品全部参加促销活动，如果选择全部分类，为全站活动，如果自选单品则可以在列表页选择参加活动的商品"><img border="0" src="../image/admin/Help Circle.jpg" style="vertical-align:middle;"></a>
            		   
                 </td>
                </tr>
                <tr>
                    <td>专题描述</td>
                    <td>
                    	<script charset="utf-8" src="../lib/kindeditor/kindeditor-min.js"></script>
						
                    	<script>
						var editor;
						KindEditor.ready(function(K) {
							editor = K.create('textarea[name="desc"]', {
								resizeType : 1,
								allowPreviewEmoticons : false,
								allowImageUpload : false,
								filterMode : false,
								langType :'<?php echo $this->_tpl_vars['config']['language']; ?>
',
							});
						});
						</script>
                        <textarea style="width:80%; height:300px" name="desc"><?php echo $this->_tpl_vars['de']['desc']; ?>
</textarea>
                    </td>
				</tr>
                <tr>
                    <td>专题头图</td>
                     <td>
                    <input name="pic" class="w350" type="text" id="pic" value="<?php echo $this->_tpl_vars['de']['pic']; ?>
" />
                    [<a href="javascript:uploadfile('上传图片','pic',0,0,'activity')">上传</a>] 
                    [<a href="javascript:preview('pic');">预览</a>]
                    [<a onclick="javascript:$('#pic').val('');" href="#">删除</a>] <span class="bz"></span>
                    </td>
                </tr>
                
                <tr>
                    <td>展示状态</td>
                    <td>
                    <input type="radio" name="status" value="1" id="open" <?php if ($this->_tpl_vars['de']['status'] == 1): ?>checked="checked"<?php endif; ?>/><label for="open">开启</label>
                     <input type="radio" name="status" value="2" id="open" <?php if ($this->_tpl_vars['de']['status'] == 2): ?>checked="checked"<?php endif; ?>/><label for="open">推荐</label>
                    <input type="radio" name="status" value="0" id="close" <?php if ($this->_tpl_vars['de']['status'] == 0): ?>checked="checked"<?php endif; ?>/><label for="close">关闭</label>
                    </td>
                </tr>
                <tr>
                    <td>seo_title</td>
                    <td><input type="text" name="seo_title" size="45" value="<?php echo $this->_tpl_vars['de']['seo_title']; ?>
"/></td>
                </tr>
                <tr>
                    <td>seo_keywords</td>
                    <td><textarea name="seo_keywords" id="seo_keywords" cols="45" rows="5" class="text" ><?php echo $this->_tpl_vars['de']['seo_keywords']; ?>
</textarea></td>
                </tr>
                <tr>
                    <td>seo_description</td>
                    <td><textarea name="seo_description" id="seo_description" cols="45" rows="5" class="text"><?php echo $this->_tpl_vars['de']['seo_description']; ?>
</textarea></td>
                </tr>
                <tr>
                    <td>&nbsp;</td>
                    <td>
                    <input class="submit" type="submit" value="提交">
                    <input name="act" type="hidden" id="action" value="<?php if (! $_GET['editid']): ?>save<?php else: ?>edit<?php endif; ?>">
                    </td>
                </tr>
                </tbody>
            </table>
            </form>
        <?php else: ?>
		<script type="text/javascript">
        $(function(){
            /* 全选 */
             $('.checkall').click(function(){
                var _self = this;
                $('.checkitem').each(function(){
                    if (!this.disabled)
                    {
                        $(this).attr('checked', _self.checked);
                    }
                });
                $('.checkall').attr('checked', this.checked);
            });	 
        });
        </script>
        <form action="" method="get">
    <input type="hidden" name="m" value="activity">
    <input type="hidden" name="s" value="special.php">
    <table class="select_table">
        <tbody>
            <tr>
                <td width="60">时间:</td>
                <td class="yui-skin-sam" width="200">
                	<input id="sdate" name="sdate" type="text" size="12" value="<?php echo $_GET['sdate']; ?>
" onfocus="lockinput(this)" />
                	<input id="edate" name="edate" type="text" size="12" value="<?php echo $_GET['edate']; ?>
" onfocus="lockinput(this)" />
            		<div id="calContainer" style="display:none; position:absolute;"></div>
            	</td>
            	
            	
            	 <td width="60">是否开始：</td>
                
                <td width="80">
                    <select name="is_start" id="is_start">
                        <option value="">全部</option>
                        <option value="1" <?php if ('1' === $_GET['is_start']): ?>selected="selected"<?php endif; ?>>进行中</option>
                        <option value="2" <?php if ('2' === $_GET['is_start']): ?>selected="selected"<?php endif; ?>>未开始</option>
                        <option value="-1" <?php if ("-1" == $_GET['is_start']): ?>selected="selected"<?php endif; ?>>已结束</option>
                    </select>
                </td>
            	
                <td width="60">状态：</td> 
                
                <td width="80">
                	<select name="statu" id="statu">
                		<option value="">全部</option>
                		<option value="1" <?php if ('1' === $_GET['statu']): ?>selected="selected"<?php endif; ?>>开启</option>
                		<option value="2" <?php if ('2' === $_GET['statu']): ?>selected="selected"<?php endif; ?>>推荐</option>
                		<option value="0" <?php if ('0' == $_GET['statu']): ?>selected="selected"<?php endif; ?>>关闭</option>
                	</select>
                </td>
                <td><input type="image" src="<?php echo $this->_tpl_vars['config']['weburl']; ?>
/image/admin/search.gif" /></td>
            </tr>
            
        </tbody>
    </table>
    </form>
        <form action="" method="post">
        <table class="table">
        	<thead>
                <tr>
                    <th class="partition" colspan="99">活动列表</th>
                </tr>
            </thead>
            <tbody>
                <tr class="header">
                    <th width="30"></th>
                    <th width="70">显示顺序</th>
                    <th width="50">专题ID</th>
                    <th>标题</th>
                    <th width="150">起止时间</th>
                    <th width="60">促销类型</th>
                    <th width="170">分类</th>
                    <th width="60">状态</th>
                    
                    <th width="100">操作</th>
                </tr>
                <?php $_from = $this->_tpl_vars['de']['list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['list']):
?>
                <tr>
                    <td><input type="checkbox" value="<?php echo $this->_tpl_vars['list']['id']; ?>
" class="checkitem" name="chk[]"></td>
                    <td><input type="text" class="w50" maxlength="3" name="displayorder[<?php echo $this->_tpl_vars['list']['id']; ?>
]" value="<?php echo $this->_tpl_vars['list']['displayorder']; ?>
" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" onkeyup="value=value.replace(/[^\d]/g,'')" /></td>
                    <td><?php echo $this->_tpl_vars['list']['id']; ?>
</td>
                    <td><?php echo $this->_tpl_vars['list']['title']; ?>
</td>
                    <td><?php echo ((is_array($_tmp=$this->_tpl_vars['list']['start_time'])) ? $this->_run_mod_handler('date_format', true, $_tmp, "%Y-%m-%d %H:%M") : smarty_modifier_date_format($_tmp, "%Y-%m-%d %H:%M")); ?>
 <br/> <?php echo ((is_array($_tmp=$this->_tpl_vars['list']['end_time'])) ? $this->_run_mod_handler('date_format', true, $_tmp, "%Y-%m-%d %H:%M") : smarty_modifier_date_format($_tmp, "%Y-%m-%d %H:%M")); ?>
</td>
                    <td><?php if ($this->_tpl_vars['list']['type'] == '1'): ?>直降<?php elseif ($this->_tpl_vars['list']['type'] == '2'): ?>满减<?php elseif ($this->_tpl_vars['list']['type'] == '3'): ?>满赠<?php else: ?>无促销<?php endif; ?></td>
                    <td>&nbsp;<?php if ($this->_tpl_vars['list']['catid'] == 0): ?>全分类<?php elseif ($this->_tpl_vars['list']['catid'] == -1): ?>单品<?php else: ?><?php echo $this->_tpl_vars['list']['cat']; ?>
<?php endif; ?></td>
                    <td><?php if ($this->_tpl_vars['list']['status'] == 1): ?>开启<?php elseif ($this->_tpl_vars['list']['status'] == 2): ?>推荐<?php else: ?>关闭<?php endif; ?></td>
                 
                    <td>
                    <a title="添加分享数据" href="?m=share_data&s=share_data_add_edit.php&operation=add&share_url=/special-<?php echo $this->_tpl_vars['list']['id']; ?>
.html"><?php echo $this->_tpl_vars['addimg']; ?>
</a>
                    <a href="?m=activity&s=special.php&operation=edit&editid=<?php echo $this->_tpl_vars['list']['id']; ?>
<?php echo $this->_tpl_vars['cond']; ?>
"><?php echo $this->_tpl_vars['editimg']; ?>
</a> 
                    <a onclick="return confirm('确定删除吗');" href="?m=activity&s=special.php&delid=<?php echo $this->_tpl_vars['list']['id']; ?>
<?php echo $this->_tpl_vars['cond']; ?>
"><?php echo $this->_tpl_vars['delimg']; ?>
</a>
                    <?php if ($this->_tpl_vars['list']['catid'] == -1): ?><a href='?m=activity&s=special_product_list.php&editid=<?php echo $this->_tpl_vars['list']['id']; ?>
<?php echo $this->_tpl_vars['cond']; ?>
'><?php echo $this->_tpl_vars['setimg']; ?>
</a><?php endif; ?>
                    
                    </td>
                </tr>
                <?php endforeach; else: ?>
                <tr>
                    <td class="norecord" colspan="99"><i></i><span>暂无符合条件的数据记录</span></td>
                </tr>
                <?php endif; unset($_from); ?>
            </tbody>
            <tfoot>
                <tr>
                	<td colspan="99">
                        <input type="checkbox" class="checkall" id="del">
                        <input type="hidden" name="act" value="op" />
                        <input type="submit" value="提交" />
                    	<div class="page"><?php echo $this->_tpl_vars['de']['page']; ?>
</div>
                    </td>
                </tr>
            </tfoot>
        </table>
        </form>
        <?php endif; ?>
    </div>
</body>
</html>